com.cete.dynamicpdf
Class EvenOddTemplate
Example : This example shows how to create an EvenOddTemplate and add it to the document.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Label;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Add 5 blank pages to the document
document.getPages().add( new Page( PageSize.LETTER ) );
document.getPages().add( new Page( PageSize.LETTER ) );
document.getPages().add( new Page( PageSize.LETTER ) );
document.getPages().add( new Page( PageSize.LETTER ) );
document.getPages().add( new Page( PageSize.LETTER ) );
// Create an even odd template and add elements to it
EvenOddTemplate template = new EvenOddTemplate();
template.getEvenElements().add( new Label( "Even Header", 0, 0, 200, 12 ) );
template.getOddElements().add( new Label( "Odd Header", 0, 0, 200, 12 ) );
template.getElements().add( new Label( "Footer", 0, 680, 200, 12 ) );
// Add the template to the document
document.setTemplate(template);
// Save the PDF document
document.draw( "[physicalpath]/MyDocument.pdf" );
}
}